home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Magazine / SoundLab / Studio16add / sources / MakeSample.asm < prev    next >
Encoding:
Assembly Source File  |  1997-11-27  |  1.7 KB  |  76 lines

  1. * Simple source to initialize a header and save it as a Studio16 3.0 sample
  2. *
  3. *    Public domain - made by Kenneth "Kenny" Nilsen
  4. *    DEMO purpose ONLY!
  5. *
  6.  
  7.     incdir    inc:
  8.     include    libraries/studio16file.i
  9.     include    lvo/exec_lib.i
  10.     include    lvo/dos_lib.i
  11.     incdir
  12.     
  13. start:    lea    header(pc),a5
  14.  
  15. * Initialize Studio16_2.0 sample header:
  16.  
  17.     move.l    #S16FID,S16F_ID(a5)        ;init file ID (KWK3)
  18.     move.l    #S16FILTERINIT,S16F_FILTER(a5)    ;set antialias filter to 1
  19.  
  20.     move.l    #S16_FREQ_CD,S16F_RATE(a5)    ;Freq   = 44100 Hz
  21.     move.w    #S16_VOL_0,S16F_VOLUME(a5)    ;Volume =    +0 dB
  22.     move.l    #S16_PAN_MID,S16F_PAN(a5)    ;Pan    =  Center
  23.  
  24. ;    move.l    #$00120902,S16F_SMPTE(a5)    ;DEMO=00:18:09:02  (HH:MM:SS:FF) SMPTE
  25.  
  26.     move.l    #(End-Sample)/2,S16F_REALSIZE(a5)    ;real size of sample
  27.     move.l    #(End-Sample)/2,S16F_EDITSIZE(a5)    ;edit size is equal here
  28.     move.l    #(End-Sample)/2-1,S16F_END(a5)        ;first SampleClip covers whole sample
  29.  
  30. ; save sample
  31.  
  32.     move.l    $4.w,a6            ;exec base
  33.     lea    LibName(pc),a1
  34.     moveq    #0,d0
  35.     jsr    _LVOOpenLibrary(a6)
  36.     move.l    d0,DosBase        ;dos library
  37.     beq    .exit
  38.  
  39.     move.l    d0,a6
  40.     move.l    #Filename,d1        ;filename
  41.     move.l    #MODE_NEWFILE,d2
  42.     jsr    _LVOOpen(a6)        ;open new file for write
  43.     move.l    d0,d7
  44.     beq    .cleanup
  45.  
  46.     move.l    d0,d1
  47.     move.l    #Header,d2
  48.     move.l    #S16F_SIZEOF,d3
  49.     jsr    _LVOWrite(a6)        ;write sample header
  50.  
  51.     move.l    d7,d1
  52.     move.l    #Sample,d2
  53.     move.l    #End-Sample,d3
  54.     jst    _LVOWrite(a6)        ;write sample data
  55.  
  56.     move.l    d7,d1
  57.     jsr    _LVOClose(a6)        ;close file
  58.  
  59. .cleanup
  60.     move.l    a6,a1
  61.     move.l    $4.w,a6
  62.     jsr    _LVOCloseLibrary(a6)    ;close dos.library
  63.  
  64. .exit    moveq    #0,d0            ;exit and return 0
  65.     rts
  66.  
  67. DosBase        dc.l    0
  68. LibName        dc.b    "dos.library",0
  69.  
  70. Filename    dc.b    "ram:TestSample_mid",0    ;change to suit your system
  71.         even
  72.  
  73. Header        dcb.b    S16F_SIZEOF,0        ;space for our header
  74. Sample        incbin    sample_raw        ;space for our sample
  75. End
  76.